// 创建响应式转换函数
function createVhToPxConverter() {
    let viewportHeight = window.innerHeight || document.documentElement.clientHeight;

    // 监听窗口大小变化
    window.addEventListener('resize', () => {
        viewportHeight = window.innerHeight || document.documentElement.clientHeight;
    });

    return function (vh: number) {
        return (vh * viewportHeight) / 100;
    };
}

const vhToPx = createVhToPxConverter();

export {vhToPx};